<template>
	<!-- 教师 预习 作业 考试 班级列表 -->
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center flex_0_ibhf"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center justify-between flex-sub fd0_0_ibhf'>
					<view class='flex flex-wrap align-center fd0_0_c0_ibhf' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">
						<text class='fu-iconfont2  fd0_0_c0_c0_ibhf'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='fd0_0_c1_c0_ibhf'>{{name}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end fd0_0_c0_ibhf'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout flex_1_ibhf">
				<template v-for='(item,key0) in list' v-if="list.length>0 && isup">
					<view class='flex flex-wrap align-center fd1_0_ibhf' :key='key0' @tap.stop="jump(item,key0)">
						<image class='fd1_0_c0_ibhf' mode="aspectFit" :src='STATIC_URL+"bjq.png"'></image>
						<view class='flex flex-direction align-stretch flex-sub'>
							<view class='fd1_0_c1_c0_ibhf'>{{type!=3?item.teachingclass_name:item.name}}</view>
							<view class="number">
								<text>已提交：</text>
								<text class='fd1_0_c1_c1_ibhf'>{{type!=3?item.submitted_num:item.submitted_num}}</text>
								<text style="color: #333333;">/{{type!=3?item.total_num:item.yk_num}}</text>
								<text style="margin-left: 32rpx;">待批阅：</text>
								<text class='fd1_0_c1_c1_ibhf'>{{type!=3?item.not_graded_num:item.not_graded_num}}</text>
							</view>

						</view>
						<text class='fu-iconfont2'>&#xe7f2;</text>
					</view>
				</template>
				<view class="" v-if="type==3">
					<fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
						:listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
				</view>
				
			</view>

			<!---flex布局flex布局结束-->
			<view v-if="list.length==0 && isup && type!=3">
				<slot>
					<view class="public-page-empty">
						<image src='/static/global/order.png'></image>
						<view class="txt">暂无数据</view>
					</view>
				</slot>
			</view>
			
		</view>
	</page-body>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				isup:false,
				name:'',
				id:'',//发布作业id
				"list": [],
				homeid:'',//	作业列表ID
				type:1,//1预习 2作业 3考试
				papercourse_id:'',//考试id
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.name=options.name
			this.id=options.id
			this.homeid=options.homeid
			this.papercourse_id=options.papercourse_id
			this.type=options.type
			if(this.type==3){
				console.log(this.papercourse_id)
				this.getlists()
			}else{
				this.getlist()
			}
			let _this=this
			// 教师提交评语
			uni.$on('addpy', (data) => {
				if(_this.type==3){
					_this.getlists()
				}else{
					_this.getlist()
				}
			});
			if (global.appTabBarType) this.toHomeDiy()
		},
		onUnload() {
			uni.$off('addpy');
		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.getlist()
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			async getlist() {
				let url=global.apiUrls.post68cd112b20308
				let obj={
						homeworkreleaserecord_id:this.id,
						homework_id:this.homeid
				}
				let datadatum = await this.$api.post(url, obj);
				this.isup = true
				if (datadatum.data.code != 1) {
					this.$message.info(datadatum.data.msg);
					return
				}
				let infodatum = datadatum.data;
				this.list = infodatum.data
				console.log(infodatum)
			},
			async getlists(type) {
				this.isup = false;
				this.minixPagingListsApi = global.apiUrls.post686f241f42d6c;
				this.pageingListApiMethod = 'post';
				this.allowOnloadGetList = false;
				console.log(this.papercourse_id)
				this.pagingListPostDataContent = {
					papercourse_id:this.papercourse_id
				}
				this.listData = [];
				this.list = this.listData;
				console.log("this.list=>", this.list)
				this.isup = true
				this.pagingListToggle();
				this.$forceUpdate()
							
						},
			jump(item, index) {
				if(this.type==3){
					// if(item.)
					uni.navigateTo({
						url: "/pages/kc/teacheryxbj/teacheryxbj?type=3&name="+item.name+'&teachingclass_id='+item.class_id+'&papercourse_id='+this.papercourse_id
					})
					return
				}
				uni.navigateTo({
					url: "/pages/kc/teacheryxbj/teacheryxbj?name="+item.teachingclass_name+'&id='+item.aid+'&homeworkreleaserecord_id='+item.homeworkreleaserecord_id+'&homework_id='+item.homework_id+'&teachingclass_id='+item.teachingclass_id
				})
			},
			pagingListPostData() {
				return this.pagingListPostDataContent
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: var(--benbenbgColor1);
		background-size: 100% auto;

		.flex_1_ibhf {
			padding: 24rpx;

			.fd1_0_ibhf {
				padding: 24rpx 0rpx 40rpx 0rpx;
				border-bottom: 1px solid #eee;

				.fd1_0_c0_ibhf {
					width: 84rpx;
					height: 84rpx;
					border-radius: 40rpx;
					margin: 0rpx 20rpx 0rpx 0rpx;
				}

				.fd1_0_c1_c0_ibhf {
					font-size: 32rpx;
					font-weight: 600;
				}

				.number {
					color: #999999;
					font-size: 24rpx;
				}

				.fd1_0_c1_c1_ibhf {
					margin: 4rpx 0rpx 0rpx 0rpx;
					font-size: 24rpx;
					color: #145EFD;
				}

				.fd1_0_c2_ibhf {
					color: rgba(153, 153, 153, 1);
				}
			}
		}

		.flex_0_ibhf {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;

			.fd0_0_ibhf {
				padding: 0rpx 32rpx 0rpx 32rpx;

				.fd0_0_c1_c0_ibhf {
					font-size: 36rpx;
					font-weight: 700;
					color: #333333;
					line-height: 50rpx;
				}
			}
		}

		.fd0_0_c0_ibhf {
			width: 120rpx;

			.fd0_0_c0_c0_ibhf {
				font-size: 36rpx;
				color: #333;
			}
		}
	}
	.public-page-empty {
			display: flex;
			justify-content: center;
			flex-direction: column;
			align-items: center;
			padding: 120upx 0 0 0;
		
			image {
				width: 300rpx;
				height: 300rpx;
			}
		
			.txt {
				font-size: 28upx;
				color: $uni-text-color;
				text-align: center;
				line-height: 100upx;
				color: var(--benben-loading-color, #999999);
			}
		
			.loadTips {
				line-height: 30upx;
			}
		
			.btn {
				width: 260upx;
				height: 78upx;
				line-height: 78upx;
				background: linear-gradient(309deg, rgba(254, 49, 0, 1) 0%, rgba(255, 90, 16, 1) 100%);
				opacity: 1;
				border-radius: 44upx;
				font-size: 28upx;
				color: #fff;
				text-align: center;
				margin-top: 100upx;
			}
		}
		
	
</style>
